package site.xuxingcan.util;

import site.xuxingcan.model.SyncKeyBean;
import site.xuxingcan.model.WXContactModel;
import site.xuxingcan.model.WXinitModel;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by xuxingcan on 2016/9/21.
 */
public class GlobalUtil {
    public static String UUID;
    public static String webpush_url;
    public static String redirect_uri;
    public static String base_uri;
    public static String cookie;

    public static SyncKeyBean SyncKey;
    public static String synckey;

    public static void gen_synckey() {
        StringBuffer synckey = new StringBuffer();
        List<SyncKeyBean.ListBean> list = GlobalUtil.SyncKey.getList();
        for (int i = 0, len = list.size(); i < len; i++) {
            synckey.append("|" + list.get(i).getKey() + "_" + list.get(i).getVal());
        }
        GlobalUtil.synckey = synckey.substring(1);
    }

    public static String userName;
    public static String nickName;
    public static String[] CharSet;

    public static String skey;
    public static String wxsid;
    public static String wxuin;
    public static String pass_ticket;

    public static class BaseRequest {
        public String Uin;
        public String Sid;
        public String Skey;
        public String DeviceID;
    }

    public static BaseRequest mBaseRequest;

    public static void genBaseRequest() {
        if (mBaseRequest != null) {
            return;
        }
        mBaseRequest = new BaseRequest();
        mBaseRequest.Uin = wxuin;
        mBaseRequest.Sid = wxsid;
        mBaseRequest.Skey = skey;
        mBaseRequest.DeviceID = "e" + System.currentTimeMillis();
    }

    public static class Member {
        public String UserName;
        public String NickName;

        public Member(String userName, String nickName) {
            UserName = userName;
            NickName = nickName;
        }
    }

    public static ArrayList<Member> groupList = new ArrayList<>();
    public static ArrayList<Member> contactList = new ArrayList<>();
}
